/**
 * 
 */
package com.thon.commons.utils;

import java.util.Calendar;
import java.util.Date;

import org.apache.commons.lang3.time.DateUtils;

/**
 * @author thon
 *
 */
public class ApplicationEnum {
	
	/**
	 * 状态种类
	 * @author thon
	 *
	 */
	public enum Status{
		user_status		{public String getName(){return "用户状态";}},
		hotel_status	{public String getName(){return "酒店状态";}},
		roomtype_status	{public String getName(){return "房型状态";}},
		room_status		{public String getName(){return "房间状态";}},
		booking_status	{public String getName(){return "酒店订单状态";}},
		food_status		{public String getName(){return "菜品状态";}},
		device_status	{public String getName(){return "设备状态";}},
		order_status	{public String getName(){return "菜品订单状态";}};
		public abstract String getName();
	}
	
	/**
	 * 酒店状态
	 */
	public enum HotelStatus{
		expired {
			@Override
			public String getCode() {
				return "expired";
			}
		},
		locked{
			@Override
			public String getCode() {
				return "locked";
			}
		},
		open{
			@Override
			public String getCode() {
				return "open";
			}
		};
		public abstract String getCode();
	}
	
	// 房型
	public enum RoomTypeStatus{
		expired {
			@Override
			public String getCode() {
				return "expired";
			}
		},
		locked{
			@Override
			public String getCode() {
				return "locked";
			}
		},
		open{
			@Override
			public String getCode() {
				return "open";
			}
		};
		public abstract String getCode();
	}
	
	// room stauts
	public enum RoomStatus{
		expired {
			@Override
			public String getCode() {
				return "expired";
			}
		},
		locked{
			@Override
			public String getCode() {
				return "locked";
			}
		},
		open{
			@Override
			public String getCode() {
				return "open";
			}
		};
		public abstract String getCode();
	}
	
	// 订单状态
	public enum BookingStatus{
		review {
			@Override
			public String getCode() {
				return "review";
			}
		},
		paying {
			@Override
			public String getCode() {
				return "paying";
			}
		},
		paid {
			@Override
			public String getCode() {
				return "paid";
			}
		},
		checkin {
			@Override
			public String getCode() {
				return "checkin";
			}
		},
		checkout {
			@Override
			public String getCode() {
				return "checkout";
			}
		},
		cancel {
			@Override
			public String getCode() {
				return "cancel";
			}
		};
		public abstract String getCode();
	}
	
	// food stauts
	public enum FoodStatus{
		expired {
			@Override
			public String getCode() {
				return "expired";
			}
		},
		locked{
			@Override
			public String getCode() {
				return "locked";
			}
		},
		open{
			@Override
			public String getCode() {
				return "open";
			}
		};
		public abstract String getCode();
	}
	
	// 菜品订单状态
	public enum OrderStatus{
		paying {
			@Override
			public String getCode() {
				return "paying";
			}
		},
		paid {
			@Override
			public String getCode() {
				return "paid";
			}
		},
		preparing {
			@Override
			public String getCode() {
				return "preparing";
			}
		},
		delivery {
			@Override
			public String getCode() {
				return "delivery";
			}
		},
		finish {
			@Override
			public String getCode() {
				return "finish";
			}
		},
		cancel {
			@Override
			public String getCode() {
				return "cancel";
			}
		};
		public abstract String getCode();
	}
	
	/**
	 * 设备状态
	 */
	public enum DeviceStatus{
		expired {
			@Override
			public String getCode() {
				return "expired";
			}
		},
		locked{
			@Override
			public String getCode() {
				return "locked";
			}
		},
		open{
			@Override
			public String getCode() {
				return "open";
			}
		};
		public abstract String getCode();
	}
	
	/**
	 * 类型种类
	 */
	public enum Type{
		bed_type 		{public String getName(){return "bed type";}},
		food_type 		{public String getName(){return "food type";}},
		facility_type 	{public String getName(){return "facility type";}},
		policy_type 	{public String getName(){return "policy type";}};
		
		public abstract String getName();
	}
	
	/**
	 * 用户状态
	 */
	public enum UserStatus{
		expired {
			@Override
			public String getCode() {
				return "expired";
			}
		},
		locked{
			@Override
			public String getCode() {
				return "locked";
			}
		},
		open{
			@Override
			public String getCode() {
				return "open";
			}
		};
		public abstract String getCode();
	}
	
	public enum Performance{
		today{
			Date now = new Date();
			public String getName(){return "today";}
			public Date getBeginDate() {
				return DateUtils.truncate(now, Calendar.DATE);
			}
			public Date getEndDate() {
				Date end = DateUtils.addDays(now, 1);
				return DateUtils.truncate(end, Calendar.DATE);
			}
		},
		yestoday{
			Date now = new Date();
			public String getName(){return "yestoday";}
			public Date getBeginDate() {
				Date begin = DateUtils.addDays(now, -1);
				return DateUtils.truncate(begin, Calendar.DATE);
			}
			public Date getEndDate() {
				return DateUtils.truncate(now, Calendar.DATE);
			}
		},
		week{
			Date now = new Date();
			public String getName(){return "7 days";}
			public Date getBeginDate() {
				Date begin = DateUtils.addDays(now, -7);
				return DateUtils.truncate(begin, Calendar.DATE);
			}
			public Date getEndDate() {
				return now;
			}
		},
		month{
			Date now = new Date();
			public String getName(){return "30 days";}
			public Date getBeginDate() {
				Date begin = DateUtils.addDays(now, -30);
				return DateUtils.truncate(begin, Calendar.DATE);
			}
			public Date getEndDate() {
				return now;
			}
		},
		year{
			Date now = new Date();
			public String getName(){return "year";}
			public Date getBeginDate() {
				Date begin = DateUtils.truncate(now, Calendar.YEAR);
				return DateUtils.truncate(begin, Calendar.DATE);
			}
			public Date getEndDate() {
				return now;
			}
		};
		public abstract String getName();
		public abstract Date getBeginDate();
		public abstract Date getEndDate();
	}
	
	public enum UserMeta{
		hotel_photo_num		{public String getName(){return "hotel_photo_num";}},
		roomtype_photo_num	{public String getName(){return "roomtype_photo_num";}};
		public abstract String getName();
	}
}
